package cyou.breathe.blog.notice.domain.service.impl;

import cn.hutool.core.lang.Validator;
import cyou.breathe.blog.base.response.BaseResponse;
import cyou.breathe.blog.email.EmailService;
import cyou.breathe.blog.notice.domain.service.MessageSender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author: breathe
 * @createTime: 2025-08-27
 */
@Component
public class EmailSender implements MessageSender {

    @Autowired
    private EmailService emailService;

    @Override
    public boolean supports(String number) {
        return Validator.isEmail(number);
    }

    @Override
    public BaseResponse send(String number, String code) {
        return emailService.sendEmail(number, code);
    }
}
